package com.liushuai.app;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * @author ：liushuai
 * @date ：Created in 2020/11/5 16:25
 * @description：${description}
 * @modified By：
 * @version: $version$
 */
@RestController
@SpringBootApplication
@EnableDiscoveryClient
@Slf4j
public class Demo1AppAplication {
    public static void main(String[] args){
        SpringApplication.run(Demo1AppAplication.class,args);
    }

    @GetMapping("/greeting")
    public String greet() {
        log.info("Access /greeting");

        List<String> greetings = Arrays.asList("Hi there", "Greetings", "Salutations");
        Random rand = new Random();

        int randomNum = rand.nextInt(greetings.size());
        return "app2";
    }

    @GetMapping("/")
    public String home() {
        log.info("Access /");
        return "Hi!2";
    }

    @GetMapping("/zidingyi")
    public String home2(@RequestParam String name) {
        log.info("Access /==================="+name);
        return "zidingyi!2============="+name;
    }
}
